/*
* Copyright (c) 2011 Connection Road.  All rights reserved.
* This program and the accompanying material are made available
* under the terms of the Eclipse Public Licnese v1.0 which is
* available at http://www.eclipse.org/legal/epl-v10.html
*/

using System.Collections.Generic;
using Microsoft.Synchronization.Files;

namespace CrSyncFilesUtils
{
    public interface IFileSynchronizer
    {

        bool PreviewMode { get; set; }
        bool CancelPending { get; set; }

        int TotalFilesUntouched { get; }
        long AvoidedBytes { get; }

        List<FileSyncPairInfo> FolderPairs { get; set; }
        List<CrSyncedFileInfo> CrSynchedFileInfoToExclude { get; set; }
        
        bool SkipFolderPairWithUid(string uid);

        void ResetOperationCounters();
        void ResetDetectedFilesCounter();
        void ResetTotalActionTaken();
        void Synchronize(int updateStatsInterval, int pauseTimeMs);
        void Stop();

        int TotalActionsTaken { get; set; }
        int PreviewedActionsTaken { get; set; }
        int TotalFilesFound { get; set; }
        int TotalDirectoriesFound { get; set; }
        int TotalSkippedOperations { get; }
        long TotalFileSize { get; set; }
        long TotalBytesToCopy { get; set; }

        /// <summary>
        /// Event handler when synchronizer starts.
        /// </summary>
        event FileSyncEventHandler FileSyncStarted;

        /// <summary>
        /// Syncing in preview mode
        /// </summary>
        event FileSyncEventHandler PreviewingSync;

        /// <summary>
        /// Syncrhonizer is syncing in actual mode.
        /// </summary>
        event FileSyncEventHandler FilesSyncing;

        /// <summary>
        /// Triggers when synchronizer is done syncing.
        /// </summary>
        event FileSyncEventHandler FilesSyncingCompleted;

        /// <summary>
        /// Deals with errors on each pair during synchronization
        /// </summary>
        event FileSyncErrorEventHandler FolderPairSyncingError;

        event FileSyncErrorEventHandler FileSyncingError;

        /// <summary>
        /// Raises a verbose event messages. Useful for writing to console.
        /// Most process log are fired here.
        /// </summary>
        event FileSyncMessageEventHandler VerboseMessages;

        /// <summary>
        /// Raises a log event messages. Useful for writing messages to log file.
        /// Only message targeted for file logging is fired here.
        /// </summary>
        event FileSyncMessageEventHandler LogMessages;

        CrSyncFileCountHolder TotalDeletedFolders { get; set; }
        CrSyncFileCountHolder TotalDeletedFiles { get; set; }
        CrSyncFileCountHolder TotalRenamedFiles { get; set; }
        CrSyncFileCountHolder TotalCreatedFolders { get; set; }
        CrSyncFileCountHolder TotalCreatedFiles { get; set; }
        CrSyncFileCountHolder TotalOverwrittenFiles { get; set; }
        
        CrSyncFileCountHolder PreviewedDeletedFolders { get; set; }
        CrSyncFileCountHolder PreviewedDeletedFiles { get; set; }
        CrSyncFileCountHolder PreviewedRenamedFiles { get; set; }
        CrSyncFileCountHolder PreviewedCreatedFolders { get; set; }
        CrSyncFileCountHolder PreviewedCreatedFiles { get; set; }
        CrSyncFileCountHolder PreviewedOverWrittenFiles { get; set; }
        CrSyncFileCountHolder PreviewedSkippedFiles { get; set; }

        /// <summary>
        /// Holds the files that were previewed
        /// </summary>
        List<CrSyncedFileInfo> PreviewedFiles { get; set; }

        /// <summary>
        /// Files that were being skipped by sync framework due to errors.
        /// </summary>
        List<CrSyncSkippChangeInfo> SkippedFiles { get; }
    }
}
